/**
 * 
 */
package org.softTank.BC.entity.services;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.softTank.BC.entity.IdEntity;

/**
 * @author Yuzone
 * 
 */
@Entity
@Table(name = "SSDB_CATEGORY")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Category extends IdEntity {

	private String name;
	private String key;
	private String description;
	private List<PartnerLinkType> partnerLinkTypeList;

	@Column(nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(nullable = false, unique = true)
	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	@Column
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "SSDB_CATEGORY_PARTNERLINKTYPE", joinColumns = { @JoinColumn(name = "CATEGORY_ID") }, inverseJoinColumns = { @JoinColumn(name = "PARTNERLINKTYPE_ID") })
	@Fetch(FetchMode.SUBSELECT)
	@OrderBy("id")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<PartnerLinkType> getPartnerLinkTypeList() {
		return partnerLinkTypeList;
	}

	public void setPartnerLinkTypeList(List<PartnerLinkType> partnerLinkTypeList) {
		this.partnerLinkTypeList = partnerLinkTypeList;
	}

}
